/**
 * All http request have been used as re usable functions
 * in the whole web project
 */

/*****************************************************
 starting jquery http request overrides
 (overridein will be usedful when load balancing 
 clientside requests)
 *****************************************************/
function requestMultipleHTML(params, _function){
	return requestHTML(WEB_BASE+'DynamicContent', params, _function);
}
function requestHTML(url, params, _function) {
	return requestGet(url, params, _function, 'html');
}

function requestGet(url, params, _function, dataType) {
	$.get(url, params, function(out) {
		return _function(out);
	}, dataType);
}

function requestPost(url, params, _function, dataType) {
	$.post(url, params, function(out) {
		return _function(out);
	}, dataType);
}

function requestAjax(url, params, _function, dataType) {
	$.ajax({
		url : url,
		dataType : dataType,
		data : params,
		success : function(out) {
			return _function(out);
		}
	});
}
/*****************************************************
ends jquery http request overrides
*****************************************************/
function openNewTab(url){

	window.open(url,'_blank');
	
}

function readURL(input)
{
      if (input.files && input.files[0])
              {
                    var reader = new FileReader();
                   reader.onload = function (e)
                                          {
                                                $('#photo')
                                                .attr('src',e.target.result)
                                                .width(285)
                                                .height(329);
                                          };
                   reader.readAsDataURL(input.files[0]);
                   }
}

function redirect(url){
	window.location = url;
}
